$(document).ready(function(){					
	var canvas = document.getElementById('canvas');//画布
	var stage = new JTopo.Stage(canvas);//舞台
	var scene = new JTopo.Scene(stage);//场景
	//显示工具栏 showJTopoToobar(stage);
	scene.background = './img/bg.jpg';//场景背景图片
	
	//9 种定位方式 3*3 (上中下 * 左中右) 
	var ps = ['Top_Left',    'Top_Center',    'Top_Right', 
			  'Middle_Left', 'Middle_Center', 'Middle_Right', 
			  'Bottom_Left', 'Bottom_Center', 'Bottom_Right'];
	
	function newNode(x,y,w,h,text, position){ //新建节点函数
		var node = new JTopo.Node(text);
		node.setBound(x,y,w,h);
		node.textPosition = position
		scene.add(node);
		return node;
	}
	
	var index = 0;
	for(var i = 0; i < 3; i++){
		for(var j = 0; j < 3; j++){
			var name = position = ps[index ++ % ps.length];
			newNode(220 + j*140, 150 + i* 140, 40, 40, name, position);
		}
	}
	
	
	var circleNode = new JTopo.CircleNode('左下偏移')
    circleNode.fillColor = '0, 0, 0';
    circleNode.setLocation(750, 300);
    circleNode.textPosition = 'Middle_Center';
    
    // 向左偏移 20像素
    circleNode.textOffsetX = -30;
    // 向下偏移 25像素
    circleNode.textOffsetY = 30;
    
    scene.add(circleNode);
    
    stage.add(scene);
    
    //居中显示
    scene.centerAndZoom();
	
		
	
});
	